#include <bits/stdc++.h>
using namespace std;

int x;
char ch;
int main() {
    cin >> x >> ch;
    int m = 8;
    x -= 1000;
    if (x > 0) {
        m += (x + 499) / 500 * 4;
    }
    if (ch == 'y')
        m += 5;
    cout << m;
    return 0;
}